package com.aliance.soo.custom.db;

import java.io.IOException;
import java.io.Reader;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class MyBatisManager {
	public static SqlSessionFactory myBatisSession;
	
	static {
		try {
			String resource = "com/aliance/soo/custom/db/mybatis/MybatisConfiguration.xml";
			Reader reader = Resources.getResourceAsReader( resource );
			myBatisSession = new SqlSessionFactoryBuilder().build(reader);
		} catch (IOException ioe) {
			ioe.printStackTrace();
		}
	}
	
	public static SqlSessionFactory getSqlSession() {
		// TODO Auto-generated method stub
		return myBatisSession;
	}

}
